/********************************************************/
/*	obj2 class by George Chew							*/
/*	For use in GeorgeLib								*/
/*	Created Mar 2013									*/
/*														*/
/*	Version 0001										*/
/********************************************************/

#ifndef __OBJ2D_H__
#define __OBJ2D_H__

#include "stdafx.h"
#include "vec2.h"
#include "Logger.h"

namespace GeorgeLib
{

	/*		How to use this class 		*/
	// obj2 a(5), b(1,2);
	// a.pos(1,1); b.pos(2,2);
	// a.checkcontain(b);

	class DLLEXPORT obj2
	{
	public:
		float	l; // length
		float	h; // height
		float	r; // radius

		// Indicates whether this object detects collision
		bool	bCollide;

		vec2	pos; // position
		vec2	dir; // direction

	public:
		obj2(void);							// constructor : no dimension values
		obj2(float R);						// constructor : object with sphere dimensions
		obj2(float L, float H);				// constructor : object with box dimensions
		obj2(float L, float H, float R);	// constructor : object with sphere and box dimensions
		obj2(obj2 &obj);					// constructor : from another object
		~obj2(void);							// destructor

		vec2	getmin(void);			// get the minimum coordinates of the bounding box
		vec2	getmax(void);			// get the maximum coordinates of the bounding box

		bool	checkcontain(obj2 & obj);	// check if obj passed in is contained in this object
		bool	checkcontain(vec2 vec);		// check if point passed in is contained in this object
		bool	checkcollide(obj2 & obj);	// check if obj passed in collides with this object

		// rotate the object
		void	rotate(float angle, float x, float y);
		void	rotate(float angle, vec2 vec);

		// output obj contents to console
		friend	ostream&		operator<<		(ostream &os, obj2 &v);
		friend	_Logger&		operator<<		(_Logger &logger, obj2 &v);
	};

} // namespace GeorgeLib

#endif // __OBJ2D_H__ //